-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Implement per-pixel linked list for OIT #21831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
IceSentry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. Thank you so much for working on this. Sorry it took so long for me to review, I got sick in the same week you opened the PR and haven't had time to come back to it since.
This is very close to what I had in mind as a follow up to my original OIT impl so I'm really happy to see it in action.
I managed to review the PR because I'm very familiar with OIT but to make the diff a bit simpler to follow I would suggest adding the depth prepass support in a separate PR to the current OIT impl. This way the linked list PR will be a bit easier to follow since it won't be mixed with the depth prepass changes.
crates/bevy_core_pipeline/src/core_3d/main_transparent_pass_3d_node.rs
Outdated
Show resolved
Hide resolved
Add `reserve_internal` to `BufferVec` Add `capacity` `set_label` `get_label` to `UninitBufferVec` Use `Vec::reserve` to reduce some allocation
|
This is in pretty good shape I believe. If you're not in a hurry to merge, I'd like to try a possible improvement where, instead of pulling the fragments in an array first at resolve, we would iterate over the linked list (N times) and pop the closest fragment. That might sound bad at first because it's O(N²) accesses to a storage buffer (non contiguous at that).
What do you think ? |
|
From what I see in backwards memory allocation and register-based block sort papers (they are complex and not worth it for games typically have fewer transparency layers), I think there is reason to believe in-place sorting in ssbo is slower. |
Objective
The current OIT stores viewport-sized fragments per layer. It uses much more memory than it can be.
Solution
Implements per-pixel linked list for OIT, which saves memory and can handle more layers. The implementation references https://github.com/KhronosGroup/Vulkan-Samples/tree/main/samples/api/oit_linked_lists
Testing
Tested with the
order_independent_transparencyexample. I also added a new scene in it.Details